<?php

/**
 * YouTubeFeedDetail
 * @deprecated 
 *
 */
class youtube_detail extends feed {
	
	private $data; 
	
	// feed definition
	var $entry_xpath = array(
		"url" => "default:id",
		"name" => "default:title",
		"duration" => "media:group/yt:duration/@seconds",
		"rating" => "gd:rating/@average",
		"thumbnail" => "media:group/media:thumbnail[1]/@url"
	);
	
	function __construct($id) {
		$url = "http://gdata.youtube.com/feeds/api/videos/$id";
		$url .= "?key=" . config::getInstance()->yt_key;
		$xml = $this->loadFeed($url, config::getInstance()->youtube_ttl);
		
		$entry = self::getAllXPath($xml);
		$entry["id"] = feed::getIdFromUrl($entry["url"]);
		unset($entry["url"]);
		
		$this->data = $entry;
	}
	
	function getData() {
		return $this->data;
	}
	
	function getAllXPath(SimpleXMLElement &$xml) {
		$ret = array();
		foreach ($this->entry_xpath as $key => $xpath) {
			$ret[$key] = self::getXPath($xml, "//".$xpath);
		}
		return $ret;
	}
	
}

?>